﻿using CatUtils.Utils.IoUtils;
using HostsTool.Currency.IoUtils;
using HostsTool.Currency.View;
using System.Windows.Forms;

namespace HostsTool.Utils
{
    internal class StartHelper
    {/// <summary>
     /// 初始化程序
     /// </summary>
        public void InitProgram()
        {
            new FloderHelper().InitFloder();
            FileHelper.FileExits(DnsStartivalue.LocalDNSFile, true);
        }

        public void OpenDnsFile(ComboBox comboBox)
        {
            MessageHelper.Alert("添加自定义DNS，每行一个。");
            FileHelper.FileExits(DnsStartivalue.LocalDNSFile, true);
            new FloderHelper().OpenFloder(DnsStartivalue.LocalDNSFile);
            if (MessageHelper.DialogResultAlert("添加完毕后，是否刷新列表？"))
            {
                comboBox.Items.Clear();
                comboBox.Items.AddRange(DnsStartivalue.InitDnsList().ToArray());
                comboBox.SelectedIndex = 0;
            }
        }
    }
}